package com.youpingou.controller;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.youpingou.service.SkuCommentService;
import com.youpingou.vo.BaseResult;
import com.youpingou.vo.CommentsResult;
import com.youpingou.vo.PageRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @auther Created by yuanxinqi
 */
@RestController
@RequestMapping
public class SkuCommentController {

    @Autowired
    private SkuCommentService skuCommentService;

    @GetMapping("/comments/{skuid}")
    public BaseResult findCommentsBySpuId(@PathVariable("skuid") Integer skuId, PageRequest req){
        CommentsResult cr = skuCommentService.findCommentsBySpuId(skuId, req);

        return BaseResult.ok(cr);

    }
}